import 'package:star_author/config/ui_constant.dart';
import 'package:star_author/utils/common_util/num_util.dart';
import 'package:star_author/utils/config_provider_util.dart';
import 'package:star_author/utils/rouces_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';

import '../../config/base_configuration.dart';
import '../../provider/config.dart';
import '../../provider/user.dart';
import '../../utils/utils.dart';
import 'dialog_type.dart';
import 'get_dialog.dart';

class DialogUtil {
  static get DeductGuaranteeDurationHours {
    return Provider.of<ConfigProvider>(Get.context!, listen: false)
        .get('settings')['deduct_guarantee_duration_hours'];
  }

  static get DescriptionOfCountFinishedRate {
    return Provider.of<ConfigProvider>(Get.context!, listen: false)
        .get('settings')['description_of_count_finished_rate'];
  }

  static get DescriptionOfPriceFinishedRate {
    return Provider.of<ConfigProvider>(Get.context!, listen: false)
        .get('settings')['description_of_price_finished_rate'];
  }

  static get ExpiredEvaluationDuration {
    return Provider.of<ConfigProvider>(Get.context!, listen: false)
        .get('settings')['expired_evaluation_duration'];
  }

  static get ExpiredEvaluationDurationWithCountDown {
    return Provider.of<ConfigProvider>(Get.context!, listen: false)
        .get('settings')['expired_evaluation_duration_with_count_down'];
  }

  static get descriptionOfTenderOpening {
    return Provider.of<ConfigProvider>(Get.context!, listen: false)
        .get('settings')['description_of_tender_opening'];
  }

  //当前用户可出价倍数
  static int get getUserTenderByGuaranteeTimes {
    return double.tryParse(
            Provider.of<UserProvider>(Get.context!, listen: false)
                .user!['tender_by_guarantee_times']
                .toString())!
        .toInt();
  }

  static String get RateForHitter {
    return NumUtil.multiply(
                Provider.of<ConfigProvider>(Get.context!, listen: false)
                    .get('settings')['rate_for_hitter'],
                100)
            .toInt()
            .toString() +
        "%";
  }

  static String get RateForTenders {
    return NumUtil.multiply(
                Provider.of<ConfigProvider>(Get.context!, listen: false)
                    .get('settings')['rate_for_tenders'],
                1)
            .toDouble()
            .toString() +
        "倍";
  }

  static showMyDialog({
    DialogType dialogType: DialogType.Sell,
    bool isButtons: true,
    GestureTapCallback? buttonOnTap,
    GestureTapCallback? leftButtonOnTap,
    GestureTapCallback? rightButtonOnTap,
    Widget? child,
    String money: "0", //回款金额
    String compensate: "0", //补偿金
    String bankNo: "0", //银行卡尾号
    bool canCancel: true,
    //需要的参数全部通过map过来 可以不修改原来的结构拓展更多新的
    Map<String, dynamic> param: const {},
  }) {
    String tips = '';

    TextAlign text_align = TextAlign.center;

    Color leftButtonColor = Colors.grey;
    Color rightButtonColor = Color(0xFFFEBA07);

    String buttonText = '知道了';

    String buttonLeftText = '知道了';
    String buttonRightText = '知道了';

    double subFontSize = 12;
    Color subColor = Color(0xFF999999);
    Color buttonTextColor = Color(0xFF999999);

    String subTitle = '订单在1小时内未支付将被取消，请尽快支付';

    switch (dialogType) {
      case DialogType.Sell:
        //购物车
        tips = '该订单的商品已售出或下架订单提交失败';
        break;
      case DialogType.BindWeChat:
        //微信
        tips = '您还没有绑定微信需绑定微信号才能微信支付';
        buttonLeftText = '稍后绑定';
        buttonRightText = '立即绑定';
        break;
      case DialogType.GiveUp:
        //未支付
        tips = '确定放弃付款吗？';
        buttonLeftText = '确定离开';
        buttonRightText = '继续支付';
        break;
      case DialogType.reflux:
        //已转回流
        tips = '已转回流';
        subTitle = '您可以在“我的回流-待寄出”中看到该回流单，还请尽快将货品寄至回流公司';
        subColor = Color(0xFF333333);
        subFontSize = 14;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonText = '查看回流单';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.cancelOrder:
        //取消
        subTitle = '取消订单后商品可能很快被卖走\n确定取消订单吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '取消订单';
        break;
      case DialogType.open_page_in_splash:
        //取消
        subTitle = '确定进入页面吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        break;
      case DialogType.deleteOrder:
        //删除
        subTitle = '订单删除后不可恢复\n确认删除订单？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '删除';
        break;
      case DialogType.confirmOrder:
        //确认收货
        subTitle = '确认收货后不可申请售后\n是否确认收？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定收货';
        break;
      case DialogType.cancelAfterSale:
        subTitle = '自动确认收货倒计时结束之前您还可以再次申请售后，确定取消售后吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        break;
      case DialogType.cancelAfterSaleAgain:
        subTitle = '该货品已超出收货倒计时，取消售后将自动确认收货，不可再申请售后，确定取消售后吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        break;
      case DialogType.createBackflow:
        // TODO: Handle this case.
        break;
      case DialogType.deleteAddress:
        //取消售后
        subTitle = '确定删除该收货地址吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        break;
      case DialogType.toPayBond:
        //取消售后
        subTitle = '需支付保证金才能出价\n结拍后未中拍，保证金随时可退';
        tips = '首次出价提示';

        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '去支付';
        break;
      case DialogType.toPayTender:
        //取消售后
        subTitle = '您有未支付的中拍单导致保证金已全部冻结，请先支付中拍费以解冻\n保证金再出价出价';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '暂不支付';
        buttonRightText = '支付中拍费';
        buttonText = '支付中拍费';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.OneKeyReflow:
        //取消售后
        subTitle = '鉴宝价格仅供参考，实际回款价格\n以买家最高出价为准，确定回流吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        break;
      case DialogType.OneKeyReflowSuccess:
        //取消售后
        subTitle = '该宝贝已转入回流\n请到“我的 - 我的回流 - 待寄出”\n中查看回流单，并请尽快将货品寄出';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.returnMoneyOfDay:
        subTitle =
            '如回款倒计时结束买家未支付中拍款，您将获得该笔回款金额的${ConfigProviderUtil.deduct_guarantee_rate_str}(最高¥${ConfigProviderUtil.max_compensation})作为补偿，且该货品会立即重新上架竞拍。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.conclusion_countdown:
        subTitle =
            '货品上架后${param['expired_evaluation_duration']}小时没有达到有效出价条件将自动到时结拍；达到有效出价条件将自动提前结拍。';
        text_align = TextAlign.start;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.list_conclusion_countdown:
        tips = '倒计时说明';
        subTitle = descriptionOfTenderOpening;
        text_align = TextAlign.start;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.cancel_sell:
        tips = '确定取消寄售吗？';
        subTitle = "确定后，该货品将在\n售后完成后自动取消寄售";
        text_align = TextAlign.center;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '暂不取消';
        buttonRightText = '确定取消';
        buttonText = '确定取消';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.detection_local_video:
        tips = '当前检测到本地有${param['count']}个视频待上传';
        subTitle = '';
        text_align = TextAlign.center;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '稍后上传';
        buttonRightText = '立即上传';
        buttonText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.stop_explaining:
        tips = '是否结束讲解?';
        subTitle = '';
        text_align = TextAlign.center;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.bindBankCard:
        subTitle = '请先绑定回款到账的银行卡后再接受回款，以便回款金额能自动到账';
        subColor = Color(0xFF333333);
        tips = '绑卡提示';
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '去绑卡';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.activationBankTips:
        subTitle =
            '您已在平台通过实名认证，可激活实名认证的银行卡(尾号$bankNo)作为收款账户，激活后如需更换，可前往“回流钱包-自动到账”中解绑并绑定新的银行卡';
        subColor = Color(0xFF333333);
        tips = '激活银行卡提示';
        subFontSize = 16;
        isButtons = false;
        buttonText = '立即激活';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.firstReturnMoney:
        subColor = Color(0xFF333333);
        child = Container(
          child: Text.rich(TextSpan(
              text: '接受回款后，且买家支付了中拍款，回款金额',
              style: TextStyle(
                fontSize: 14.sp,
                color: UIConstant.color33,
                height: 1.5,
              ),
              children: [
                TextSpan(
                  text: '¥$money',
                  style: TextStyle(
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w500,
                    color: UIConstant.colorE02020,
                  ),
                ),
                TextSpan(
                  text: '将自动提现到您绑定的银行卡，请您提供银行卡和身份信息',
                )
              ])),
          padding: EdgeInsets.symmetric(horizontal: 14.w),
          margin: EdgeInsets.only(bottom: 20.w),
        );
        tips = '首次回款提示';
        buttonLeftText = '取消';
        buttonRightText = '填写资料';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.returnMoneyToBack:
        subColor = Color(0xFF333333);
        child = Container(
          child: Column(
            children: [
              Text(
                "回款金额",
                style: TextStyle(
                  fontSize: 14.sp,
                  color: UIConstant.color99,
                ),
              ),
              SizedBox(
                height: 9.w,
              ),
              Text(
                "¥$money",
                style: TextStyle(
                  fontSize: 24.sp,
                  color: UIConstant.color33,
                  fontWeight: FontWeight.w500,
                ),
              ),
              SizedBox(
                height: 9.w,
              ),
              Text.rich(
                TextSpan(
                    text: '如买家$DeductGuaranteeDurationHours小时内未支付中拍款，您将获得',
                    style: TextStyle(
                        fontSize: 14.sp,
                        color: UIConstant.color33,
                        height: 1.5),
                    children: [
                      TextSpan(
                        text: '¥$compensate',
                        style: TextStyle(
                          fontSize: 16.sp,
                          fontWeight: FontWeight.w500,
                          color: UIConstant.colorE02020,
                        ),
                      ),
                      TextSpan(
                        text: '补偿金发放至您的回流账户，可在“我的-回流钱包”中查看并提现',
                      )
                    ]),
                textAlign: TextAlign.center,
              )
            ],
          ),
          padding: EdgeInsets.symmetric(horizontal: 14.w),
          margin: EdgeInsets.only(bottom: 20.w),
        );
        buttonLeftText = '取消';
        buttonRightText = '接受回款';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.returnMoneyToBackGold:
        subTitle = '回款金额随金价波动，最终回款金额以接受回款并完成签章确认时的回收金价为准。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonRightText = '知道了';
        isButtons = false;
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.user_wallet_automatic_account:
        tips = '自动提现账户说明';
        subTitle =
            '无需操作提现，该账户的金额都将自动提现到已绑定的银行卡，这部分金额包括回流成功、违约补偿、寄售卖出的款项，如有提现失败金额，请联系客服处理。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonRightText = '知道了';
        isButtons = false;
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.user_wallet_backflow_account:
        tips = '回流账户说明';
        subTitle = '该账户的余额需要您自行操作提现，提现后款项将转账到已绑定的银行卡，这里的金额包括活动红包等款项。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonRightText = '知道了';
        isButtons = false;
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.firstConsignmentTips:
        subColor = Color(0xFF333333);
        tips = '首次寄售提示';
        child = Container(
          child: Text.rich(TextSpan(
              text: '委托寄售后，货品将以中拍价',
              style: TextStyle(
                fontSize: 14.sp,
                color: UIConstant.color33,
                height: 1.5,
              ),
              children: [
                TextSpan(
                  text: '¥$RateForTenders',
                  style: TextStyle(
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: '的价格寄售，卖出后将收取',
                ),
                TextSpan(
                  text: '成交价的$RateForHitter',
                  style: TextStyle(
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: '作为平台佣金，扣除佣金后的金额将自动提现到您绑定的银行卡，请您提供银行卡和身份信息',
                ),
              ])),
          padding: EdgeInsets.symmetric(horizontal: 14.w),
          margin: EdgeInsets.only(bottom: 20.w),
        );
        buttonLeftText = '取消';
        buttonRightText = '填写资料';

        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.firstTakeBack:
        subColor = Color(0xFF333333);
        subTitle = '您的货品买家们非常喜爱，现还有一次重新竞拍的机会，是否再次上架竞拍？';
        buttonLeftText = '重新竞拍';
        subFontSize = 16;
        buttonRightText = '依旧收回';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.ReceivingCountdown:
        subTitle = '收货倒计时结束之前可申请售后，倒计时结束后，未申请售后的货品将确认收货不可再申请售后。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.OpenBidderCountdown:
        subColor = Color(0xFF333333);
        isButtons = false;
        subFontSize = 16;
        subTitle =
            '未达结拍人数的回流单，将在上架竞拍$ExpiredEvaluationDuration小时后自动结拍；倒计时结束无一人出价的回流单将重新进入$ExpiredEvaluationDurationWithCountDown小时倒计时。';
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.UserLogoutSure:
        subTitle = '注销后，该账号中的所有信息将被清空无法查看，您确定要注销该账号吗？';
        subColor = Color(0xFF333333);
        tips = '账号注销确认';
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定注销';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.BondPriceTips:
        subTitle =
            '这里的“可出价”额度为当前选择支付保证金金额的$getUserTenderByGuaranteeTimes倍，即：如果要对某件货品出价¥${getUserTenderByGuaranteeTimes * ConfigProviderUtil.minimum_earnest_money_price}，则至少支付¥${ConfigProviderUtil.minimum_earnest_money_price}保证金。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.RetrieveJD:
        subTitle = '取货方式确定后不可修改，确认选择京东快递寄回吗？';
        subColor = Color(0xFF333333);
        tips = '京东快递寄回';
        subFontSize = 16;
        buttonLeftText = '返回修改';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.RetrieveJD_Merge:
        subTitle = '取货方式确定后不可修改，\n确认选择京东快递寄回吗？';
        subColor = Color(0xFF333333);
        tips = '京东快递合并发货';
        subFontSize = 16;
        buttonLeftText = '返回修改';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.RetrieveSH:
        subTitle = '取货方式确定后不可修改，确认选择顺丰快递寄回吗？';
        subColor = Color(0xFF333333);
        tips = '顺丰到付寄回';
        subFontSize = 16;
        buttonLeftText = '返回修改';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.RetrieveSH_Merge:
        subTitle = '取货方式确定后不可修改\n确认选择顺丰快递寄回吗？';
        subColor = Color(0xFF333333);
        tips = '顺丰快递合并发货';
        subFontSize = 16;
        buttonLeftText = '返回修改';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.RetrieveSM:
        subTitle = '取货方式确定后不可修改，确认选择上门取货吗？';
        subColor = Color(0xFF333333);
        tips = '自行上门取货';
        subFontSize = 16;
        buttonLeftText = '返回修改';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.order_combine_ship_fix_address:
        subTitle = '该地址有合并发货的订单，修改地址请联系客服';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '返回';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.cant_connect_microphone:
        subTitle = '当前直播鉴宝未开放\n请稍后再发起鉴宝申请';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.UserBreakConnectMicrophone:
        subTitle = '用户已断开连接';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.DisconnectWithUserConnect:
        subTitle = '当前无法关闭连麦功能，请先断开进行中的连麦后再关闭';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.TreasureLiveNotOpenConnect:
        subTitle = '鉴宝直播暂未开播';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.AnchorOfflineWithUserConnect:
        subTitle = '当前无法下播，请先断开进行中的连麦后再下播';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.LiveNotOpen:
        subTitle = '当前直播间未开播，请稍后再试';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.Disconnect:
        subColor = Color(0xFF333333);
        subFontSize = 16;
        subTitle = '您当前正在与主播连麦中\n是否断开连线？';
        buttonLeftText = '取消';
        buttonRightText = '断开连接';
        rightButtonColor = Color(0xFFE02020);
        break;
      case DialogType.AnchorDisconnect:
        subColor = Color(0xFF333333);
        subFontSize = 16;
        subTitle = '当前正在连线中\n确认要断开连线吗？';
        buttonLeftText = '取消';
        buttonRightText = '断开连接';
        rightButtonColor = Color(0xFFE02020);
        break;
      case DialogType.AnchorDisconnectWithUserConnect:
        subColor = Color(0xFF333333);
        subFontSize = 16;
        subTitle = '当前还有用户在连线中\n确认要连线新的用户吗？';
        buttonLeftText = '取消';
        buttonRightText = '断开连接';
        rightButtonColor = Color(0xFFE02020);
        break;
      case DialogType.CloseMicrophoneConnect:
        subColor = Color(0xFF333333);
        subColor = Color(0xFF333333);
        subFontSize = 16;
        subTitle = '关闭鉴宝后，等待鉴宝队列将被清空，直播间恢复为讲解模式，确认关闭鉴宝吗？';
        buttonLeftText = '取消';
        buttonRightText = '关闭鉴宝';
        rightButtonColor = Color(0xFFE02020);
        break;

      case DialogType.apply_connect_microphone:
        subColor = Color(0xFF333333);
        if (param['count'] <= 0) {
          child = Container(
            child: Text.rich(
              TextSpan(
                text: '当前没有人等待连麦\n确认是否申请连麦？',
                style: TextStyle(
                  fontSize: 16.sp,
                  color: UIConstant.color33,
                  height: 1.5,
                ),
              ),
              textAlign: TextAlign.center,
            ),
            padding: EdgeInsets.symmetric(horizontal: 14.w),
            margin: EdgeInsets.only(bottom: 20.w),
          );
        } else {
          child = Container(
            child: Text.rich(
              TextSpan(
                text: '当前还有',
                style: TextStyle(
                  fontSize: 16.sp,
                  color: UIConstant.color33,
                  height: 1.5,
                ),
                children: [
                  TextSpan(
                    text: '${param['count']}',
                    style: TextStyle(
                      color: Color(0xFFFF8F00),
                      fontSize: 16.sp,
                      fontWeight: FontWeight.w500,
                    ),
                  ),
                  TextSpan(
                    text: ' 人等待连麦\n确认是否申请连麦？',
                  ),
                ],
              ),
              textAlign: TextAlign.center,
            ),
            padding: EdgeInsets.symmetric(horizontal: 14.w),
            margin: EdgeInsets.only(bottom: 20.w),
          );
        }
        buttonLeftText = '取消';
        buttonRightText = '申请连麦';
        rightButtonColor = Color(0xFFE02020);
        break;
      case DialogType.exit_queue_microphone:
        subColor = Color(0xFF333333);
        child = Container(
          child: Text.rich(
            TextSpan(
              text: '您已申请连麦前面还有 ',
              style: TextStyle(
                fontSize: 16.sp,
                color: UIConstant.color33,
                height: 1.5,
              ),
              children: [
                TextSpan(
                  text: '${param['count']}',
                  style: TextStyle(
                    color: Color(0xFFFF8F00),
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w500,
                  ),
                ),
                TextSpan(
                  text: ' 人在等待',
                ),
              ],
            ),
          ),
          padding: EdgeInsets.symmetric(horizontal: 14.w),
          margin: EdgeInsets.only(bottom: 20.w),
        );
        buttonLeftText = '取消';
        buttonRightText = '退出排队';
        rightButtonColor = Color(0xFFE02020);
        break;
      case DialogType.banned_cant_connect_microphone:
        subTitle = '您已被禁言，不可申请连麦\n请等禁言解除后再申请';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.open_live_cant_recycle:
        subTitle = '该货品确定不可回收吗?';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = true;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.cancel_treasure:
        subTitle = '鉴宝专家正在赶来的路上 确定取消鉴宝吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '暂不取消';
        buttonRightText = '确认取消';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.good_not_insure:
        subTitle = '您还没有对货品退回物流投保，如您确定不需要投保，物流途中有任何问题回流平台将不承担责任';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '不投保';
        buttonRightText = '去投保';
        isButtons = true;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.bidder_detail_turnover_rate_description:
        subTitle = DescriptionOfCountFinishedRate;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.bidder_detail_price_rate_description:
        subTitle = DescriptionOfPriceFinishedRate;
        subColor = Color(0xFF333333);
        subFontSize = 16;
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.logistics_price:
        subTitle = '每单最低保费为5元，\n当前声明价值低于¥12500，\n是否将声明价值改为¥12500？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '无需修改';
        buttonRightText = '确认修改';
        isButtons = true;
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.bid_infinite_price:
        subTitle =
            '保证金余额够¥${ConfigProviderUtil.max_deductible_amount}单次出价不限额度，中拍后如未按时支付中拍款，将最高扣除违约金¥${ConfigProviderUtil.max_deductible_amount}。';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.open_live_can_recycle:
        subTitle = '';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '返回修改';
        buttonRightText = '确认提交';
        List list = [];
        child = Container(
          alignment: Alignment.center,
          child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: List.generate(
                list.length,
                (index) {
                  if (list[index].weight.text.isEmpty ||
                      list[index].purity.text.isEmpty) {
                    return Container();
                  }
                  return Column(
                    children: [
                      Text(
                        list[index].dialogTitle,
                        style: TextStyle(
                          fontSize: 14.sp,
                          color: rgba(51, 51, 51, 1),
                          fontWeight: FontWeight.w500,
                        ),
                      ),
                      SizedBox(
                        height: 6.w,
                      ),
                      Container(
                        child: Row(
                          children: [
                            Expanded(
                              child: Container(
                                height: 40.w,
                                decoration: BoxDecoration(
                                  color: rgba(250, 250, 250, 1),
                                  borderRadius: BorderRadius.circular(4.w),
                                ),
                                child: Row(
                                  children: [
                                    SizedBox(
                                      width: 10.w,
                                    ),
                                    Text(
                                      "重量",
                                      style: TextStyle(
                                          fontSize: 14.sp,
                                          color: rgba(102, 102, 102, 1)),
                                    ),
                                    SizedBox(
                                      width: 15.w,
                                    ),
                                    Text(
                                      "${list[index].weight.text.isEmpty ? "0" : list[index].weight.text}",
                                      style: TextStyle(
                                        fontSize: 16.sp,
                                        fontWeight: FontWeight.bold,
                                        color: rgba(255, 143, 0, 1),
                                      ),
                                    ),
                                    Text(
                                      "g",
                                      style: TextStyle(
                                        fontSize: 12.sp,
                                        fontWeight: FontWeight.bold,
                                        color: rgba(255, 143, 0, 1),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                            SizedBox(
                              width: 10.w,
                            ),
                            Expanded(
                              child: Container(
                                height: 40.w,
                                decoration: BoxDecoration(
                                  color: rgba(250, 250, 250, 1),
                                  borderRadius: BorderRadius.circular(4.w),
                                ),
                                child: Row(
                                  children: [
                                    SizedBox(
                                      width: 10.w,
                                    ),
                                    Text(
                                      "纯度",
                                      style: TextStyle(
                                          fontSize: 14.sp,
                                          color: rgba(102, 102, 102, 1)),
                                    ),
                                    SizedBox(
                                      width: 15.w,
                                    ),
                                    Text(
                                      "${list[index].purity.text.isEmpty ? "0" : list[index].purity.text}",
                                      style: TextStyle(
                                        fontSize: 16.sp,
                                        fontWeight: FontWeight.bold,
                                        color: rgba(255, 143, 0, 1),
                                      ),
                                    ),
                                    Text(
                                      "%",
                                      style: TextStyle(
                                        fontSize: 12.sp,
                                        fontWeight: FontWeight.bold,
                                        color: rgba(255, 143, 0, 1),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                            ),
                          ],
                        ),
                        margin: EdgeInsets.symmetric(
                          horizontal: 12.w,
                        ),
                      ),
                      SizedBox(
                        height: 18.w,
                      ),
                    ],
                  );
                },
              )),
        );
        rightButtonColor = Color(0xFFE02020);
        isButtons = true;
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.system_alert_window_tips:
        subTitle = '使用APP后台播放功能需要开启悬浮窗权限，请确认是否开启?';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.anchor_dont_explain:
        subTitle = '是否将该货品从待讲解中删除？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        isButtons = true;
        buttonLeftText = '取消';
        buttonRightText = '确认删除';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.money_to_height_tips:
        subColor = Color(0xFF333333);
        tips = '';
        child = Container(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Container(
                child: RoucesUtil.getAssetsIcon('ic_money_to_hight_tips_lt', 32),
              ),
              Container(
                child: Text(
                  '出价过高提醒',
                  style: TextStyle(
                    fontSize: 18.sp,
                    color: rgba(51, 51, 51, 1),
                    fontWeight: FontWeight.w500,
                  ),
                ),
                margin: EdgeInsets.only(
                  bottom: 12.w,
                  top: 10.w,
                ),
              ),
              Text.rich(
                TextSpan(
                  text: "您的出价",
                  children: [
                    TextSpan(
                      text: "¥${param['money']}",
                      style: TextStyle(
                        color: rgba(224, 32, 32, 1),
                        fontWeight: FontWeight.w500,
                      ),
                    ),
                    TextSpan(
                      text: " 超出源头市场参考价上限，请确认出价是否有误",
                    ),
                  ],
                ),
                style: TextStyle(
                  fontSize: 16.sp,
                  color: rgba(51, 51, 51, 1),
                ),
                textAlign: TextAlign.center,
              ),
            ],
          ),
          padding: EdgeInsets.symmetric(horizontal: 14.w),
          margin: EdgeInsets.only(bottom: 20.w),
        );
        buttonLeftText = '继续出价';
        buttonRightText = '返回修改';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.agree_price_tips:
        subColor = Color(0xFF333333);
        tips = '';
        child = Container(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Container(
                child: Text(
                  '估价',
                  style: TextStyle(
                    fontSize: 14.sp,
                    color: rgba(153, 153, 153, 1),
                  ),
                ),
                margin: EdgeInsets.only(
                  bottom: 10.w,
                ),
              ),
              Container(
                alignment: Alignment.center,
                margin: EdgeInsets.only(
                  bottom: 10.w,
                ),
                child: Text(
                  "${getPriceWithList(
                    param['price_range'],
                    intl: true,
                  )}",
                  style: TextStyle(
                    fontSize: 24.sp,
                    color: rgba(224, 32, 32, 1),
                    fontWeight: FontWeight.w500,
                  ),
                  textAlign: TextAlign.center,
                ),
              ),
              Container(
                child: Text(
                  "同意估价后将自动结束录播\n确定同意该估价吗？",
                  style: TextStyle(
                    fontSize: 16.sp,
                    color: rgba(51, 51, 51, 1),
                  ),
                  textAlign: TextAlign.center,
                ),
              ),
            ],
          ),
          padding: EdgeInsets.symmetric(horizontal: 14.w),
          margin: EdgeInsets.only(bottom: 20.w),
        );
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.voluntarily_returned_money_tips:
        subTitle = '设置自动接受回款之前请先绑卡，以便自动接受回款后款项能及时到账';
        subColor = Color(0xFF333333);
        tips = '绑卡提示';
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '立即绑卡';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.rtmp_error_net_down_tips:
        subTitle = '当前检测到推流失败是因为网络问题,为了使直播间预览和IOS悬浮播放正常，请重新开播!';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = false;
        buttonText = '知道了';
        buttonTextColor = Color(0xFFFEBA07);
        break;
      case DialogType.consignments_over_7_days:
        subTitle = '您将跳转到客服会话，请将您要重新回流的货品编号发送给客服，由客服办理上架竞拍';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = true;
        break;
      case DialogType.phone_message_day_restrict:
        subTitle = param['tips'] ?? "同一手机号码24小时内验证次数已达上限，请联系客服处理";
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '联系客服';
        isButtons = true;
        break;

      case DialogType.check_file_with_id:
        subTitle = '检测到当前讲解货品本地视频不完整，请删除后重新录制?';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        isButtons = true;
        break;
      case DialogType.cancel_request_dialog:
        subTitle = '视频正在上传中\n确定取消上传吗？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '继续上传';
        buttonRightText = '确定取消';
        rightButtonColor = Color(0xFFE02020);
        isButtons = true;
        break;
      case DialogType.delete_local_video:
        subTitle = '是否删除${param['title']}的录制视频？';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '删除视频';
        rightButtonColor = Color(0xFFE02020);
        isButtons = true;
        break;

      case DialogType.convert_backflow:
        subTitle = '确定转回流吗?转回流后将不能再委托寄售';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        isButtons = true;
        break;
      case DialogType.convert_mall_order_backflow:
        subTitle = '确定转回流么?\n受市场等因素影响,估价可能有波动';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        isButtons = true;
        break;
      case DialogType.convert_mall_order_backflow_again:
        subTitle = '确认再次回流么?\n受市场等因素影响,估价可能有波动';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '取消';
        buttonRightText = '确定';
        buttonTextColor = Color(0xFFFEBA07);
        isButtons = true;
        break;
      case DialogType.convert_mall_order_backflow_successful:
        subTitle = '转回流成功\n可尽快预约寄出转回流货品';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '继续转回流';
        buttonRightText = '预约快递';
        buttonTextColor = Color(0xFFFEBA07);
        isButtons = true;
        break;
      case DialogType.convert_backflow_successful:
        subTitle = '具体可查看「我的回流-竞拍中」\n受市场等因素影响，估价可能有波\n动，请知悉~';
        subColor = Color(0xFF333333);
        subFontSize = 16;
        buttonLeftText = '关闭';
        buttonRightText = '去查看';
        buttonTextColor = Color(0xFFFEBA07);
        isButtons = true;
        break;
    }

    showGetDialog(
      Container(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            SizedBox(
              height: 20.w,
            ),
            tips == ''
                ? Container()
                : Container(
                    alignment: Alignment.center,
                    child: Text(
                      tips,
                      style: TextStyle(
                        fontSize: 16.sp,
                        color: ColorConf.black,
                        fontWeight: FontWeight.w500,
                      ),
                      textAlign: TextAlign.center,
                    ),
                    padding: EdgeInsets.symmetric(horizontal: 14.w),
                    margin: EdgeInsets.only(bottom: 20.w),
                  ),
            child ??
                Builder(
                    builder: (context) => subTitle == ''
                        ? Container()
                        : Container(
                            alignment: Alignment.center,
                            child: Text(
                              subTitle,
                              style: TextStyle(
                                  fontSize: subFontSize.sp,
                                  height: 1.5,
                                  color: subColor),
                              textAlign: text_align,
                            ),
                            padding: EdgeInsets.symmetric(horizontal: 14.w),
                            margin: EdgeInsets.only(bottom: 20.w),
                          )),
            Container(
              height: 43.w,
              decoration: BoxDecoration(
                  border: Border(
                      top: BorderSide(width: 1.w, color: Color(0xFFEEEEEE)))),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                children: !isButtons
                    ? [
                        Expanded(
                          child: GestureDetector(
                            onTap: () {
                              Get.back();
                              if (buttonOnTap != null) {
                                buttonOnTap();
                              }
                            },
                            child: Container(
                              child: Text(
                                buttonText,
                                style: TextStyle(
                                    fontSize: 16.sp, color: buttonTextColor),
                                textAlign: TextAlign.center,
                              ),
                              width: double.infinity,
                            ),
                            behavior: HitTestBehavior.opaque,
                          ),
                        ),
                      ]
                    : [
                        Expanded(
                          child: GestureDetector(
                            behavior: HitTestBehavior.opaque,
                            onTap: () {
                              Get.back();
                              if (leftButtonOnTap != null) {
                                leftButtonOnTap();
                              }
                            },
                            child: Container(
                              child: Text(
                                buttonLeftText,
                                style: TextStyle(
                                    fontSize: 16.sp,
                                    color: leftButtonColor,
                                    fontWeight: FontWeight.w500),
                                textAlign: TextAlign.center,
                              ),
                              width: double.infinity,
                            ),
                          ),
                        ),
                        Container(
                          height: 43.w,
                          width: 1.w,
                          color: Color(0xFFEEEEEE),
                        ),
                        Expanded(
                            child: GestureDetector(
                          behavior: HitTestBehavior.opaque,
                          onTap: () {
                            Get.back();
                            if (rightButtonOnTap != null) {
                              rightButtonOnTap();
                            }
                          },
                          child: Container(
                            child: Text(
                              buttonRightText,
                              style: TextStyle(
                                  fontSize: 16.sp,
                                  color: rightButtonColor,
                                  fontWeight: FontWeight.w500),
                              textAlign: TextAlign.center,
                            ),
                            width: double.infinity,
                          ),
                        ))
                      ],
              ),
            )
          ],
        ),
      ),
      barrierDismissible: canCancel,
    );
  }
}
